package com.hospital.schedule.module.controller;


import com.hospital.common.base.Result;
import com.hospital.common.dto.schedule.module.FindDoctorByDoctorScheduleDto;
import com.hospital.schedule.module.service.ITUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-09-17
 */
@RestController
//@RequestMapping("/t-user")
public class TUserController {

    @Autowired
    private ITUserService tUserService;
    /**
     * 根据排班需要查询医生
     * @param findDoctorByDoctorScheduleDto 查询开始时间和科室
     * @return 查询传入时间之后七天有排班信息的医生
     */
    @PostMapping("/findDoctorByDoctorSchedule")
    public Result findDoctorByDoctorSchedule(@RequestBody FindDoctorByDoctorScheduleDto findDoctorByDoctorScheduleDto){
        return Result.success(tUserService.findDoctorByDoctorSchedule(findDoctorByDoctorScheduleDto));

    }
    /**
     * 根据科室查询医生
     */
    @PostMapping("/findDoctorByDepartmentId")
    public Result findDoctorByDepartmentId(@RequestParam("departmentId" )Long departmentId){
        return Result.success(tUserService.findDoctorByDepartmentId(departmentId));
    }
    /**
     * 查询所有医生
     */
    @PostMapping("/findAllDoctor")
    public Result findAllDoctor(@RequestParam("departmentId" )Long departmentId){
        return Result.success(tUserService.findAllDoctor(departmentId));
    }
    /**
     * 根据医生id查询科室id
     */
    @PostMapping("/findDoctorDepartmentByUserId")
    public Result findDoctorDepartmentByUserId(@RequestParam("doctorId" )Long doctorId){
        return Result.success(tUserService.findDoctorInfoDepartmentByUserId(doctorId));
    }
    /**
     * 根据医生id查询该医生所属科室下的所有医生
     */
    @PostMapping("/findDoctorInfoDepartmentByUserId")
    public Result findDoctorInfoDepartmentByUserId(@RequestParam("doctorId" )Long doctorId){
        return Result.success(tUserService.findAllDoctorInfoDepartmentByUserId(doctorId));
    }

}
